import { defineStore } from 'pinia'
import { doGetAccessList } from '@/api/role'

const usePermissionStore = defineStore('permissionStore', {
  state: () => ({
    permissionList: []
  }),
  actions: {
    async getPermissionList() {
      doGetAccessList().then(res => {
        this.permissionList = res.access_list
        return Promise.resolve(this.permissionList)
      }).catch(err => {
        console.log(err)
      })
    }
  }
})

export default usePermissionStore
